from django_filters import filters
from django_filters.rest_framework import FilterSet

from web.models import Issues

# allow_filter_name = ['issues_type', 'status',
#                      'priority', 'assign',
#                      'attention', 'milestone_id']


class IssueFilterSet(FilterSet):
    subject = filters.CharFilter(field_name='subject', lookup_expr='icontains')
    issue_type = filters.CharFilter(field_name='issue_type', lookup_expr='icontains')
    status = filters.NumberFilter(field_name='status',lookup_expr='exact')

    class Meta:
        model = Issues
        fields = ['subject', 'issue_type','status']